<div class="modal fade" tabindex="-1" role="dialog" aria-labelledby="productTastListAddLabel" data-backdrop="static" aria-hidden="true"
    *ngIf="initService.init" id="productTastListAdd">
    <div class="modal-dialog modal-lg modal-dialog-centered" role="document">
        <div class="modal-content">
            <form #addForm="ngForm" (ngSubmit)="_onSubmit(addForm.value)">
                <!-- 模态框头部 -->
                <div class="modal-header">
                    <h4 class="modal-title" id="productTastListAddLabel">{{modalTitle}}</h4>
                    <button type="button" class="close" data-dismiss="modal" (click)="clear()">&times;</button>
                </div>
                <!-- 模态框主体 -->
                <div class="modal-body">
                    <div class="container">
                        <div class="input_div task-txt-row" *ngIf="type === 'addChildTask'">
                            <label class="input_title ">上层任务：</label>
                            <strong *ngIf="taskData && taskData.name" style="line-height: 32px;">{{taskData.name}}</strong>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2"><span class="red required">* </span>任务名称：</label>
                                <input type="text" [disabled]="type=='detail'" class="form-control col-lg-10 col-md-10 col-sm-10 col-xs-10 first-fa" autocomplete="off" required name="name" #name="ngModel"
                                    [(ngModel)]="taskName" placeholder="请输入任务名称" />
                            </div>
                            <p class="text-danger" style="margin-left: 17% !important;" *ngIf="name.invalid && (name.touched)">任务名称不能为空</p>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2"><span class="red required">* </span>选择模板：</label>
                                <input type="text" class="form-control creator-style" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'"
                                    autocomplete="off" name="templateName" [(ngModel)]="templateNames" [disabled]="true" />
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" data-toggle="modal" data-target="#taskTemplateModel" (click)="template.getTaskMetaDataTemplateList();"
                                    [disabled]="name.invalid || isEdit">选择</button>
                            </div>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2"><span class="red required">* </span>分配给：</label>
                                <input type="text" class="form-control creator-style" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'"
                                 autocomplete="off" name="taskAssignBy" [(ngModel)]="taskAssignUserNames" [disabled]="true" />
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" data-toggle="modal" data-target="#assignPersons" (click)="assignTo.getTaskAssignList();assignTo.getSelectedAssignPeople();"
                                    [disabled]="name.invalid">选择</button>
                            </div>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-12">预计完成时间：</label>
                                <input type="text" [disabled]="type=='detail'" class="form-control" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'"
                                autocomplete="off" name="planCompleteDate" #dp="bsDatepicker"
                                    bsDatepicker [bsConfig]="{ dateInputFormat: 'YYYY-MM-DD'}" [ngModel]="planCompleteDate" /><!-- [minDate]="minDate" -->
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" (click)="dp.toggle()" [attr.aria-expanded]="dp.isOpen" [disabled]="name.invalid">选择</button>
                            </div>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2"><span class="red required">* </span>审核人：</label>
                                <input type="text" class="form-control creator-style" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'" 
                                autocomplete="off" name="taskCheckBy" #taskCheckBy="ngModel" [(ngModel)]="taskAuditUserNames" [disabled]="true" />
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" data-toggle="modal" data-target="#auditPersons" (click)="auditPersons.getTastAuditList()"
                                    [disabled]="name.invalid">选择</button>
                            </div>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-12">预计审核时间：</label>
                                <input type="text" [disabled]="type=='detail'" class="form-control" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'" 
                                autocomplete="off" name="planCheckDate" #dpCheck="bsDatepicker"
                                    bsDatepicker [bsConfig]="{ dateInputFormat: 'YYYY-MM-DD'}" [(ngModel)]="planCheckDate" /> 
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" (click)="dpCheck.toggle()" [attr.aria-expanded]="dpCheck.isOpen" [disabled]="name.invalid">选择</button>
                            </div>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2"><span class="red required">* </span>分配主题词表：</label>
                                <input type="text" class="form-control" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'"
                                autocomplete="off" name="themeWordNames" [(ngModel)]="themeWordNames" [disabled]="true" />
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" data-toggle="modal" data-target="#distributeThemeTabs" (click)="themewords.getThemeWordTableList(type, taskData)"
                                    [disabled]="name.invalid">选择</button>
                            </div>
                        </div>
                        <div class="input_div" *ngIf="taskType != '2'">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 task-txt-row">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2"><span class="red required">* </span>所属项目：</label>
                                <input type="text" class="form-control" [ngClass]="type!='detail' ? 'col-lg-8 col-md-8 col-sm-8 col-xs-8': 'col-lg-10 col-md-10 col-sm-10 col-xs-10'"
                                       autocomplete="off" value="{{projectInfo|arrayToStr:'projectName'}}" [disabled]="true" />
                                <button type="button" *ngIf="type!='detail'" class="btn btn-primary" data-toggle="modal" data-target="#distributeProjectTabs" (click)="projects.getProjectList(type, taskData)"
                                        [disabled]="name.invalid || isEdit">选择</button>
                            </div>
                        </div>
                        <div class="input_div">
                            <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 textarea-style">
                                <label class="input_title col-lg-2 col-md-2 col-sm-2 col-xs-2">描述：</label>
                                <textarea [disabled]="type=='detail'" class="form-control col-lg-10 col-md-10 col-sm-10 col-xs-10" name="description" [(ngModel)]="description"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <!-- 模态框底部 -->
                <div class="modal-footer" style="width: 100%;">
                    <button type="submit" *ngIf="type!='detail'" class="btn btn-primary" data-toggle="modal" [disabled]="isSubmitVal() || (type!='edit' && taskId!='')">确定</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal" (click)="clear();">取消</button>
                    
                    <button type="button" class="btn btn-primary" *ngIf="taskType != '2' && (!taskData || (type == 'edit' && taskData.parentId == 0))" data-toggle="modal"
                        data-target="#taskProductList" [disabled]="addForm.invalid || taskId==''" (click)="listproduct.getProductList(taskId,projectId)">分配内容</button>
                    <button type="button" class="btn btn-primary" *ngIf="taskType == '2' && (!taskData || (type == 'edit' && taskData.parentId == 0))" data-toggle="modal"
                        data-target="#taskThemeTableList" [disabled]="addForm.invalid || taskId==''" (click)="themeTable.getThemeTabList(taskId)">分配内容</button>

                    <button type="button" class="btn btn-primary" *ngIf="taskType != '2' && (type == 'addChildTask' || (type == 'edit' && taskData.parentId != 0))"
                        data-toggle="modal" data-target="#childTaskProductList" [disabled]="addForm.invalid || taskId==''" (click)="childlistproduct.getSubTaskUnAssignedProduct(taskId)">新增任务内容</button>

                    <button type="button" class="btn btn-primary" *ngIf="taskType == '2' && (type == 'addChildTask' || (type == 'edit' && taskData.parentId != 0))"
                    data-toggle="modal" data-target="#taskThemeTableList" [disabled]="addForm.invalid || taskId==''" (click)="themeTable.getChildThemeTabList(taskId)">新增任务内容</button>
                </div>
            </form>
        </div>
    </div>
</div>

<!-- 模板 -->
<app-template #template [taskName]="taskName" [templateId]="templateIds" (templateNames)="getTemplateNames($event)" (templateIds)="getTemplateIds($event)"></app-template>
<!-- 模板 -->

<!-- 分配给Start -->
<app-product-indexing-task-list-assign-to #assignTo [selectedAssignPersonsNames]="taskAssignUserNames" [taskName]="taskName"
    (assignPersonsNames)="getAssignPersonsNames($event)"></app-product-indexing-task-list-assign-to>
<!-- 分配给End -->

<!-- 审核人Start -->
<app-product-indexing-task-list-audit-persons #auditPersons [selectedAuditPersonsNames]="taskAuditUserNames" [taskName]="taskName"
    (auditUserNames)="getAuditPersonsNames($event)"></app-product-indexing-task-list-audit-persons>
<!-- 审核人End -->

<!-- 分配主题词表Start -->
<app-product-indexing-task-list-theme #themewords [selectedThemeWordNames]="themeWordNames" [selectedThemeWordIds]="themeWordIds"
    [taskName]="taskName" (themeWordNames)="getThemeWordNames($event);" (themeWordIds)="getThemeWordIds($event);"></app-product-indexing-task-list-theme>
<!-- 分配主题词表End -->

<!-- 分配项目 -->
<product-indexing-task-list-project  [taskName]="taskName" [projectInfo]="projectInfo" #projects></product-indexing-task-list-project>
<!-- 分配项目 -->

<!-- 分配任务内容Start(主任务) -->
<app-product-indexing-task-list-product #listproduct></app-product-indexing-task-list-product>
<!-- 分配任务内容End -->

<!-- 新增任务内容Start(子任务) -->
<app-product-indexing-child-list-product #childlistproduct></app-product-indexing-child-list-product>
<!-- 新增任务内容End --> 

<!-- 主题词标引新增内容Start -->
<app-theme-table #themeTable></app-theme-table>
<!-- 主题词标引新增内容End --> 